Skip to content

Removed "End the start signal by setting data line high for 40 micros…#51

Closed
krzychb wants to merge 1 commit intoadafruit:masterfrom
krzychb:master
Closed

Removed "End the start signal by setting data line high for 40 micros…#51
krzychb wants to merge 1 commit intoadafruit:masterfrom
krzychb:master

Conversation

@krzychb
Copy link

@krzychb krzychb commented Dec 20, 2015

…econds"

Reference: #48 (comment)

@w-h many thanks for this fix!

@joseluis joseluis mentioned this pull request Aug 28, 2016

// Now start reading the data line to get the value from the DHT sensor.
pinMode(_pin, INPUT_PULLUP);
delayMicroseconds(10); // Delay a bit to let sensor pull data line low.
Copy link

@vlad-sh vlad-sh Sep 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found out there are must be some "smart" delay instead delayMicroseconds(10):

pinMode(_pin, INPUT_PULLUP); delayMicroseconds(10); // Delay a bit to let sensor pull data line low.

The delay may be like:

if (expectPulse(HIGH) == 0) { DEBUG_PRINTLN(F("Timeout waiting for start signal high pulse.")); _lastresult = false; return _lastresult; }

If no delay, next expectPulse(LOW) function often returns 0, because _pin is still HIGH (sensor takes from 20 to 200 microseconds to pull-down line to LOW, according datasheet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants